package com.bwf.buffer;

import javax.imageio.IIOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/17 13:58
 * @Copyright 博为峰
 */
public class BufferedReaderDemo {
    public static void main(String[] args) {
        //Reader in = new FileReader("fw01.txt");
//        m1();
        String line = null;
        try (FileReader fileReader = new FileReader("fw01.txt");
             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
            while ((line = bufferedReader.readLine()) != null) {
                System.out.println("line = " + line);
            }
        } catch (IOException e) {

        }

    }

    private static void m1() {
        String line = null;
        try (FileReader fileReader = new FileReader("fw01.txt");
             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
            line = bufferedReader.readLine();
            System.out.println("line = " + line);

            line = bufferedReader.readLine();
            System.out.println("line = " + line);
        } catch (IOException e) {

        }
    }
}
